from django.db import models

# Create your models here.

class Author(models.Model):
    name = models.CharField(max_length=48, verbose_name='作者')
    class Meta:
        db_table = 'Author'
    def __str__(self):
        return self.name


class Books(models.Model):
    bookname = models.CharField(max_length=48, verbose_name='图书名称')
    price = models.DecimalField(max_digits=7, decimal_places=2, default=99.9, verbose_name='价格')
    author = models.ForeignKey(Author, on_delete=models.CASCADE)
    class Meta:
        db_table = 'Books'
    def __str__(self):
        return self.bookname,self.price
